﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NS.BLL.Systems;
using NS.Model.Systems;
using NS.Utilities;

public partial class Systems_AreaModify : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.QueryString["ID"].ToString() != "0")
            {
                Area Area = AreaService.GetAreaById(int.Parse(Request.QueryString["ID"]));
                txtAreaNumber.Text = Area.AreaNumber;
                txtAreaName.Text = Area.AreaName;
                txtCarnumber.Text = Area.ShortAreaName;
            }
        }
    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        if (UtilityService.UpdateFieldByPK("Area", "AreaName,AreaNumber,ShortAreaName", new Object[] { txtAreaName.Text.Trim(), txtAreaNumber.Text.Trim(), txtCarnumber.Text.Trim() }, "ID", Request.QueryString["ID"]) > 0)
        {
            MessageBox.AppendScript(this, "$(':input[id$=\"btnBindData\"]', window.parent.document.body).click();");
        }
        else
        {
            MessageBox.ShowSaveError(this);
        }
    }
}